﻿<%@ Page Language="C#" MasterPageFile="~/manage/NestedMasterPage1.master" AutoEventWireup="true" CodeBehind="area3.aspx.cs" Inherits="map.manage.area3" Title="设置区镇" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head2" runat="server">
    <link href="../outstyle.css" rel="stylesheet" type="text/css" />
    <link href="../Stylesheet1.css" rel="stylesheet" type="text/css" />
    <script src="../js/dropdowncontent.js" type="text/javascript"></script>

    <script src="../js/mapiconmaker_packed.js" type="text/javascript"></script>

    <script src="../js/CBScript.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
<asp:Literal ID="Literal_map" runat="server"></asp:Literal>
    <div id="grid">
  
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
   
    <asp:Label ID="county" runat="server" Text="county">市县：</asp:Label>
    <asp:DropDownList ID="DropDownList2" runat="server" 
   
         onselectedindexchanged="DropDownList2_SelectedIndexChanged" AutoPostBack="True" 
            >
    </asp:DropDownList>

    <asp:UpdatePanel ID="grid_update" runat="server">
    <ContentTemplate>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        Width="600px"
        CellPadding="4" ForeColor="#333333" GridLines="None" 
        onrowdeleted="GridView1_RowDeleted" onrowdeleting="GridView1_RowDeleting" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" 
        onselectedindexchanging="GridView1_SelectedIndexChanging" 
         DataKeyNames="RECID" BorderWidth="1px"             >
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:BoundField DataField="RECID" HeaderText="RECID" SortExpression="RECID" Visible="False"/>
            <asp:BoundField DataField="区编码" HeaderText="区编码" SortExpression="区编码" >
            <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="县编码" HeaderText="县编码" SortExpression="县编码" >
              <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
              <asp:BoundField DataField="taobaolong" HeaderText="经度" >
                    <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
                    <asp:BoundField DataField="taobaolat" HeaderText="纬度" >
            <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:CommandField ShowSelectButton="True" />
            <asp:CommandField ShowDeleteButton="True" />
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" 
            HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
         <EmptyDataTemplate>
                    当前区内没有区域数据,请在下方增加区域.
                </EmptyDataTemplate>
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    </ContentTemplate>
    </asp:UpdatePanel>
    
    
   当前记录ID: <asp:Label ID="Label_recid" runat="server" Text="RECID"></asp:Label><br />
    <asp:Label ID="districtLabel" name="districtLabe" runat="server">区：</asp:Label>
    <asp:TextBox ID="newDistrict" name="newDistrict" runat="server"></asp:TextBox><span class="style5">&nbsp;*</span>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="必须填写项目。" ControlToValidate="newDistrict"></asp:RequiredFieldValidator>
    <br /><asp:Label ID="mapLatLabel" name="mapLatLabel" runat="server">经度：</asp:Label>
    <asp:TextBox ID="mapLng" name="mapLng" runat="server" Enabled="False"></asp:TextBox>
    <span class="style5">&nbsp;*</span>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="在地图上标记。" ControlToValidate="MapLat"></asp:RequiredFieldValidator>
    <br /><asp:Label ID="mapLngLabel" name="mapLatLabel" runat="server">纬度：</asp:Label>
    <asp:TextBox ID="MapLat" name="MapLat" runat="server" Enabled="False"></asp:TextBox>
    <span class="style5">&nbsp;*</span>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="在地图上标记。" ControlToValidate="mapLng"></asp:RequiredFieldValidator>
        <br />
        <asp:Button ID="Button1" runat="server" Text="增加" onclick="Button1_Click" /> 
     <asp:Button ID="Button2" runat="server" Text="修改" onclick="Button2_Click" /><br />
       </ContentTemplate></asp:UpdatePanel>
    <%--<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="添加" />
    <asp:Button ID="Button2" runat="server" Text="更新" />--%>
    </div>
    <div style="width:500px;height:5px;"></div>
       <div style="width:100%; height:300px;border-color:Gray; border-style:solid; border-width:3px; " id="map_canvas"></div>
  <script src="../js/dropdowncontent.js" type="text/javascript"></script>

    <script src="../js/mapiconmaker_packed.js" type="text/javascript"></script>
    <script type="text/javascript">
        var map;
//        var geocoder = null;
//        function showAddress(address) {
//            if (geocoder) {
//                geocoder.getLatLng(
//          address,
//          function(point) {
//              if (!point) {
//                  alert("不能解析: " + address);
//              } else {
//                  map.setCenter(point, 13);
//                  var marker = new GMarker(point);
//                  map.addOverlay(marker);
//                  marker.openInfoWindowHtml(address);
//              }
//          }
//        );
//            }
//        }
        function markpos2(zlong, zlat, desc) {
            map.clearOverlays();
            var point1 = new GLatLng(zlat, zlong);
            var marker1 = new GMarker(point1);
            GEvent.addListener(marker1, "click", function() {
                marker1.openInfoWindowHtml("标注此位置");
            });
            map.addOverlay(marker1);
            map.setCenter(point1, 14);
        }
        function markpos(zlong, zlat, desc) {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map_canvas"));


                map.setMapType(G_NORMAL_MAP);
                map.addControl(new GMapTypeControl());
                map.addControl(new GLargeMapControl());
                //        map.enableContinuousZoom();
               
                map.enableGoogleBar();

                var center = new GLatLng(zlat, zlong);
                map.setCenter(center, 14);



                GEvent.addListener(map, "click", function(overlay, latlng) {
                if (latlng) {
                    var myHtml = "标注此位置";
                    //m.removeOverlay(marker);
                    map.clearOverlays();

                    map.openInfoWindow(latlng, myHtml);
                        var lat = latlng.lat();
                        var lon = latlng.lng();
                        //map.clearOverlays();
                        document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_MapLat").value = lat;
                        document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder3_mapLng").value = lon;
                        var point = new GLatLng(lat, lon);
                        var marker = new GMarker(point);
                        GEvent.addListener(marker, "click", function() {
                            marker.openInfoWindowHtml("标注此位置");
                        });
                        map.addOverlay(marker);
                    }
                });
                var point1 = new GLatLng(zlat, zlong);
                var marker1 = new GMarker(point1);
                GEvent.addListener(marker1, "click", function() {
                    marker1.openInfoWindowHtml("标注此位置");
                });
                map.addOverlay(marker1);
            }
        }
    </script> 



</asp:Content>

